#ifndef _RMRMANIPULATOR_
#define _RMRMANIPULATOR_
#include "Solenoid.h"
#include "DigitalInput.h"
#include "Counter.h"
#include "DriverStation.h"
#include "RMRUtil.h"
#include "PressAndHoldButton.h"
#include "RapidFireButton.h"
#include "RMRPIDIO.h"
#include "RMRDrive.h"
#include "RMRIO.h"

/*
 * RMRManipulator.h
 * 
 * Declaration of class RMRManipulator
 * 
 * Manages manipulator code
 */


class RMRManipulator
{
public:
	// constructor
	RMRManipulator(Joystick *joy);
	
	// methods (add documentation)
	void InitManipulator();  
	void doManipulator();
	
	void TestButton();
	
	// timing config
	
	// min number of loops the ball switch must be pressed to be considered on (3 balls in the chute)
	static const UINT32 BALL_SWITCH_TIME = 8;
	
	// on and off config for the fire button
	// in terms of # of samples (0.05 seconds apart)
	static const UINT32 FIRE_BUTTON_ON_SAMPLES = 5;
	static const UINT32 FIRE_BUTTON_OFF_SAMPLES = 11;
	
	

	
	// conveyor speed config
	static const float CONVEYOR_FWD_SPEED = 1.0;
	static const float CONVEYOR_RVS_SPEED = -1.0;
	//static const float CONVEYOR_RVS_SLOW_SPEED = -0.4;

private:
	
	// ball launcher solenoids
	Solenoid shoot_extend;
	Solenoid shoot_retract;
	
	// ball chute door solenoid
	Solenoid door_extend;
	Solenoid door_retract;
	
	// button in ball chute to detect presence of balls
	PressAndHoldButton ball_switch;
	
	// fire button is a rapid fire button
	RapidFireButton fire_button;
	//GenericButton fire_button;
	
	// test rapid fire button
	//RapidFireButton test_fire_button;
	
	Victor left_conveyor_motor;
	Victor right_conveyor_motor;
	
	Relay compressor_relay;
	//DigitalInput max_pressure_switch;
	ButtonFromGeneric max_pressure_switch;
	
	ButtonFromGeneric conveyor_fwd_switch;
	ButtonFromGeneric conveyor_rvs_switch;
	//ButtonFromGeneric conveyor_rvs_slow_switch;

	Joystick *joystick;
};

#endif
